package com.clstu.utils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * 测试自己写的工具类dml
 */
public class JDBCUtilsUse {
    public static void main(String[] args) throws SQLException {
        Connection connection = JDBCUtils.getConnection();
//        String sql = "update actor set name = '吴京' where name ='刘德华'";//增
//        String sql = "delete from actor where name ='吴京'";//删
        String sql="update actor set id = 3 where id = 2";//改
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        int i = preparedStatement.executeUpdate();
        System.out.println((i>0?"操作成功":"操作失败"));
        JDBCUtils.close(null,preparedStatement,connection);
    }
}
